<?php

class SF_Album_Block_Lists extends Mage_Catalog_Block_Product_List {
	
	protected $_productCollection; 
	
	protected function _getProductCollection() {
		if (is_null($this->_productCollection)) {
			$filter = array(
				'common_brand'=>array('eq'=>'xiaomi'),
			);
			
			$productCollection = Mage::getResourceModel('catalog/product_collection')
									->addAttributeToSelect('*')
									->addAttributeToFilter('status', 1)
									->addAttributeToFilter('visibility', 4)
									->addAttributeToFilter('approval', 2);
			foreach($filter as $key=>$val){
				$productCollection->addAttributeToFilter($key,$val);
			}
			
			/*set Default sort*/
			if(!$this->getRequest()->getParam('order')){
				$productCollection->setOrder('updated_at', 'dasc');
			}
			
			Mage::getModel('catalog/layer')->prepareProductCollection($productCollection);
			$this->_productCollection = $productCollection;
		}
		return parent::_getProductCollection();
	}

}
